﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace RiskMan.Providers.QuikIO
{
    public delegate void StatusEventHandler ( String msgError, String name, bool isConnect, object sender );
    public delegate void TransEventHandler ( object error, int tid, double orderId, string msgError );
    public delegate void TransEventHandlerAcc (object error, int tid, double orderId, string msgError, string acc);

    public abstract class AbstractEventHandlers
    {
        public event StatusEventHandler OnStatusChanged;
        public event TransEventHandler OnStatusTrans;
        public event TransEventHandlerAcc OnStatusTransAcc;

        public virtual void OnChangedStatus ( String msgError, String name, bool isConnect, object sender )
        {
            StatusEventHandler handler = OnStatusChanged;
            if ( handler != null )
            {
                handler( msgError, name, isConnect, sender );
            }
        }

        public virtual void OnTransStatus ( object error, int tid, double orderId, string msgError )
        {
            TransEventHandler handler = OnStatusTrans;
            if ( handler != null )
            {
                handler( error, tid, orderId, msgError );
            }
        }

        public virtual void OnTransStatusAcc (object error, int tid, double orderId, string msgError, string acc)
        {
            TransEventHandlerAcc handler = OnStatusTransAcc;
            if (handler != null)
            {
                handler(error, tid, orderId, msgError, acc);
            }
        }
    }
}
